package com.lolong.hic;

import java.util.ArrayList;

import com.lolong.model.Establishment;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.Toast;

public class CategoryActivity extends Activity implements OnClickListener {

	private Button foodBtn, fashionBtn, electBtn;
	private ImageButton backBtn, favoritesButton;
	
	private Intent intent;
	private SQLiteConnector connector;

	private ArrayList<Establishment> favorites;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		initComponents();
	}

	private void initComponents() {

		
		connector = new SQLiteConnector(this);
		
		setContentView(R.layout.category);

		foodBtn = (Button) findViewById(R.id.foodButton);
		foodBtn.setOnClickListener(this);

		fashionBtn = (Button) findViewById(R.id.fashionButton);
		fashionBtn.setOnClickListener(this);

		electBtn = (Button) findViewById(R.id.electButton);
		electBtn.setOnClickListener(this);
		
		favoritesButton = (ImageButton) findViewById(R.id.favoriteButton);
		favoritesButton.setOnClickListener(this);
		
		backBtn = (ImageButton) findViewById(R.id.back);
		backBtn.setOnClickListener(this);
		
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.activity_category, menu);
		return true;
	}

	@Override
	public void onClick(View v) {

		switch (v.getId()) {

		case R.id.foodButton:
			intent = new Intent(CategoryActivity.this, SearchActivity.class);
			intent.putExtra("Category", "food");
			startActivity(intent);
			break;
			
		case R.id.fashionButton:
			intent = new Intent(CategoryActivity.this, SearchActivity.class);
			intent.putExtra("Category", "fashion");
			startActivity(intent);
			break;
			
		case R.id.electButton:
			intent = new Intent(CategoryActivity.this, SearchActivity.class);
			intent.putExtra("Category", "electronics");
			startActivity(intent);
			break;
		
		case R.id.favoriteButton:
			intent = new Intent(CategoryActivity.this, FavoritesActivity.class);
			startActivity(intent);
			break;
		
		case R.id.back:
			intent = new Intent(CategoryActivity.this, MainActivity.class);
			startActivity(intent);
			break;
	
		}
	}

}
